package readFilejavascript;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class ReadFileJavaScript {
    public static void main(String[] args) {
        StringBuilder path = new StringBuilder("D:/work/xikuan/biz/mfbgs/web/jsp/plugin/mfbgs/purchase/editPurchase.js");
        writeToDat(path.toString());
    }
    //读取文本文件
    public static String[][] writeToDat(String path) {
        File file = new File(path);
        List<String> list = new ArrayList<String>();
        String[][] strings = null;

        try {
            InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "utf8");
            BufferedReader bw = new BufferedReader(isr);
            String line = null;
            while ((line = bw.readLine()) != null) {
                //System.out.println(line);
                list.add(line);
            }
            bw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        strings = new String[list.size()][14];
        for (int i = 0; i < list.size(); i++) {
            String[] st = list.get(i).split("\t");
            for (int j = 0; j < st.length; j++) {
                strings[i][j] = st[j];
                System.out.println(strings[i][j]);
            }


        }
        System.out.println("load data success!");
        return strings;
    }
}
